/*
 * Seth Andrews - Object Oriented Design
 * MetaPackage file - Note that documentation is still in the works,
 * 					  but do notice that I have been documenting where needed.
 * 					  This file is pretty straight forward.
 */

import java.util.ArrayList;

// Class to store Package details
class MetaPackage {
	private ArrayList<MetaClass> classList = new ArrayList<MetaClass>();
	private String packageName = "default";
	ArrayList test;
	
	public MetaPackage() {
	}
	
	public void addClass(MetaClass c) {
		classList.add(c);
	}
	
	public void setPackageName(String packageName) {
		this.packageName = packageName;
	}
	public String getPackageName() {
		return packageName;
	}
	
	public String toString() {
		String ret = "PackageName \n";
		ret += "------------------------------------------------------------------------\n";
		ret += getPackageName() + "\n\n";
		for(int i = 0; i < classList.size(); i++) {
			ret += classList.get(i).toString() + "\n";
		}
		return ret;
	}
}

// Class to store Class details
class MetaClass {
	private ArrayList<MetaMethod> methodList = new ArrayList<MetaMethod>();
	private ArrayList<MetaAttribute> attributeList = new ArrayList<MetaAttribute>();
	private String className;
	private String superClassName = "Object";
	private String classModifier = "default";
	
	public MetaClass() {
	}
	
	public void addMethod(MetaMethod m) {
		methodList.add(m);
	}
	public void addAttribute(MetaAttribute a) {
		attributeList.add(a);
	}
	
	public String toString() {
		String ret = "ClassName \t\t SuperClassName \t ClassModifier \n";
		ret += "------------------------------------------------------------------------\n";
		ret += getClassName() + "\t\t" + getSuperClassName() + "\t\t" + getClassModifier() + "\n\n";
		
		ret += "Modifier \t Static? \t ReturnType \t MethodName\n";
		ret += "------------------------------------------------------------------------\n";
		for(int i = 0; i < methodList.size(); i++) {
			ret += methodList.get(i).getModifier() + "\t\t";
			if (methodList.get(i).getStatic().equals("static"))
				ret += "True" + "\t\t";
			else
				ret += "False" + "\t\t";
			ret += methodList.get(i).getReturnType() + "\t\t";
			ret += methodList.get(i).getName() + "\n";
		}
		
		ret += "\nModifier \t Static? \t Final? \t Type \t\t AttributeName\n";
		ret += "------------------------------------------------------------------------\n";
		for(int i = 0; i < attributeList.size(); i++) {
			ret += attributeList.get(i).getModifier() + "\t\t";
			if (attributeList.get(i).getStatic().equals("static"))
				ret += "True" + "\t\t";
			else
				ret += "False" + "\t\t";
			if (attributeList.get(i).getFinal().equals("final"))
				ret += "True" + "\t\t";
			else
				ret += "False" + "\t\t";
			ret += attributeList.get(i).getType() + "\t\t";
			ret += attributeList.get(i).getName() + "\n";
		}		
		
		return ret;
	}
	
	public String getMethodDetails() {
		String ret = "";
		for(int i = 0; i < methodList.size(); i++) {
			ret += "Name: " + methodList.get(i).getName();
			ret += " Modifier: " + methodList.get(i).getModifier();
			ret += " Is Static: " + methodList.get(i).getStatic();
			ret += " Return Type: " + methodList.get(i).getReturnType();
			ret += "\n";
		}
		return ret;
	}
	
	public String getAttributeDetails() {
		String ret = "";
		for(int i = 0; i < attributeList.size(); i++) {
			ret += "Name: " + attributeList.get(i).getName();
			ret += " Modifier: " + attributeList.get(i).getModifier();
			ret += " Is Static: " + attributeList.get(i).getStatic();
			ret += " Is Final: " + attributeList.get(i).getFinal();
			ret += " Type: " + attributeList.get(i).getType();
			ret += "\n";
		}
		return ret;
	}
	
	public void setClassName(String className) {
		this.className = className;
	}
	public String getClassName() {
		return className;
	}
	public void setSuperClassName(String superClassName) {
		this.superClassName = superClassName;
	}
	public String getSuperClassName() {
		return superClassName;
	}
	public void setClassModifier(String classModifier) {
		this.classModifier = classModifier;
	}
	public String getClassModifier() {
		return classModifier;
	}
	
}

// Class to store Method details
class MetaMethod {
	private String name;
	private String modifier = "default";
	private String returnType;
	private String isStatic = "";
	// Parameters
	
	public MetaMethod() {
	}
	
	public void setName(String name) {
		this.name = name;
	}
	public String getName() {
		return name;
	}
	public void setModifier(String modifier) {
		this.modifier = modifier;
	}
	public String getModifier() {
		return modifier;
	}
	public void setReturnType(String returnType) {
		this.returnType = returnType;
	}
	public String getReturnType() {
		return returnType;
	}
	public void setStatic(String isStatic) {
		this.isStatic = isStatic;
	}
	public String getStatic() {
		return isStatic;
	}
}

// Class to store Attribute details
class MetaAttribute {
	private String name;
	private String modifier = "default";
	private String type;
	private String isStatic = "";
	private String isFinal = "";
	// Value
	
	public MetaAttribute() {
	}
	
	public void setName(String name) {
		this.name = name;
	}
	public String getName() {
		return name;
	}
	public void setModifier(String modifier) {
		this.modifier = modifier;
	}
	public String getModifier() {
		return modifier;
	}
	public void setType(String type) {
		this.type = type;
	}
	public String getType() {
		return type;
	}
	public void setStatic(String isStatic) {
		this.isStatic = isStatic;
	}
	public String getStatic() {
		return isStatic;
	}
	public void setFinal(String isFinal) {
		this.isFinal = isFinal;
	}
	public String getFinal() {
		return isFinal;
	}
}